-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collection of small fixes #1842
Conversation
Changing the tolerance for the pdep test worked for that assertion, but the numerical differences also carry through to the sensitivity analysis, which is causing the test to fail. |
@@ -531,6 +531,8 @@ def _write(mol, identifier_type, backend): | |||
logging.debug('Backend {0} is not able to generate {1} for this molecule:\n' | |||
'{2}'.format(option, identifier_type, mol.to_adjacency_list())) | |||
|
|||
logging.error('Unable to generate identifier for this molecule:\n{0}'.format(mol.to_adjacency_list())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead add the adjlist to the error message below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about doing that originally. One consideration is that with the current setup, logging goes into RMG.log, while the error goes into stderr, which is only printed to the terminal (or slurm/sge output files). I can move it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, then let's keep it. I'm OK with all other commits too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might not be relevant here but the discussion reminded me: I am a fan of using logging.exception()
in an exception handler to add context and make sure the original stack trace ends up in the log. Can then raise()
the original exception as if you hadn’t caught it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might not be relevant here but the discussion reminded me: I am a fan of using logging.exception()
in an exception handler to add context and make sure the original stack trace ends up in the log. Can then raise()
the original exception as if you hadn’t caught it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was actually hoping that this would be a good opportunity to use logging.exception(), but that has to be called from an exception handler. It seemed easier to log this message once in this function rather than logging the exception in each function which calls it.
I do think there are a lot of instances where we use logging.error
when catching exceptions where logging.exception
could be used instead.
Codecov Report
@@ Coverage Diff @@
## master #1842 +/- ##
==========================================
+ Coverage 43.91% 43.96% +0.05%
==========================================
Files 83 83
Lines 21564 21518 -46
Branches 5652 5639 -13
==========================================
- Hits 9469 9461 -8
+ Misses 11048 10996 -52
- Partials 1047 1061 +14
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of quick comments. Add your fix for the pdep test, rebase, and I'll merge.
and wb (total bond energy of bonds broken) with w0 = (wf+wb)/2 | ||
""" | ||
mol = None | ||
a_dict = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked and these functions are essentially the same, but the one we are keeping in arrhenius.pyx has a few additional PEP-8 changes. Can you make these changes?
ADict
-->a_dict
- Opitionally, things like
bd2bde
-->bd2_bde
. There are a couple of these variables that I different, but it is PEP-8 as is, so only change if you prefer it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -2758,63 +2758,6 @@ def add_atom_labels_for_reaction(self, reaction, output_with_resonance=True): | |||
for species in reaction.reactants + reaction.products: | |||
species.generate_resonance_structures() | |||
|
|||
def get_w0(self, rxn): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions are also listed under rmgpy.data.kinetics.family in rmg2to3.py. I am not sure if this needs to be updated, as what you really want is for these functions to instead call Arrhenius. But I doubt this will come up anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the function has existed long enough for anyone to have scripts using it (except Matt). I added a change to remove them from rmg2to3.py.
rmgpy/thermo/thermoengine.py
Outdated
err += (thermo.get_heat_capacity(T) - thermo0.get_heat_capacity(T)) ** 2 | ||
err = math.sqrt(err / len(Tlist)) / constants.R | ||
# logging.log(logging.WARNING if err > 0.2 else 0, 'Average RMS error in heat capacity fit to {0} = {1:g}*R'.format(spc, err)) | ||
# if thermo.__class__ != thermo0.__class__: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it is better to comment out so that it is easy to find in case anyone else ever needs it, but calculating the error in the fit is fairly straight forward, so if this is something we decide to implement in the future it won't take long to write from scratch, and the resulting implementation might be better for it. I think we can delete this code altogether, but if you prefer it can stay commented out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the code. You're right that it would be easy to rewrite if ever needed.
self.assertAlmostEquals(rxn.kinetics.get_rate_coefficient(1000.0, 1.0), 88.88253229631246) | ||
# Accept a delta of 0.2, which could result from numerical discrepancies | ||
# See RMG-Py #1682 on GitHub for discussion | ||
self.assertAlmostEquals(rxn.kinetics.get_rate_coefficient(1000.0, 1.0), 88.88253229631246, delta=0.2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about making this a percentage test.
self.assertLess((abs(rxn.kinetics.get_rate_coefficient(1000.0, 1.0) - 88.88253229631246)) / 88.88253229631246,
0.01)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was disappointed that assertAlmostEquals
did not support a percentage delta, but I think I would prefer the simplicity of using it with a fixed delta over calculating the percentage. I could change the delta to 0.01*88.88 if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that is okay, we can leave it as is then. I do like the simplicity of just using delta
Likely left over from move to kinetics.arrhenius Resolves #1826
We were not doing anything with the results, so it was doing pointless computations. Resolves #1812
This makes it easier to figure out the problematic molecule
This enables identifier generation for surface species using OpenBabel as the backend Copies the approach used for RDKit by replacing X with Pt
There is one new commit replacing the |
mock was added into the standard library in Python 3.3
Motivation or Problem
This PR addresses a number of minor issues in preparation for the 3.0 release.
Description of Changes
Please see the individual commit messages for the changes.
Testing
I think passing unit tests should be sufficient since these are all relatively minor.
Reviewer Tips
Thoughts on the approaches chosen here would be nice.
I think the increased tolerance for the pdep test may be worth additional discussion. There are still some ongoing efforts to try and identify the root cause of that issue.